import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue'),
  },
  {
    path: '/home',
    name: 'home',
    redirect: '/index',
    component: () => import('../views/home.vue'),
    children: [
      {
        path: '/index',
        name: 'index',
        component: () => import('../views/index')
      },
      {
        path: '/newsDataManage',
        name: 'newsDataManage',
        component: () => import('../views/newsDataManage')
      },
      {
        path: '/studentManage',
        name: 'studentManage',
        component: () => import('../views/studentManage')
      },
      {
        path: '/classManage',
        name: 'classManage',
        component: () => import('../views/classManage')
      },
      {
        path: '/schoolManage',
        name: 'schoolManage',
        component: () => import('../views/schoolManage')
      },
      {
        path: '/schoolNews',
        name: 'schoolNews',
        component: () => import('../views/schoolNews')
      },
      {
        path: '/schoolMateInfo',
        name: 'schoolMateInfo',
        component: () => import('../views/schoolMateInfo')
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
